<template>
  <div class="detail-top">
    <div class="img-container">
      <img :src="path" alt="">
      <div class="subText" v-show="subText !== undefined">
        <p>{{subText}}</p>
      </div>
      <div class="mask" ref="mask"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DetailTop',
  props: {
    path: {
      type: String,
      default: '',
      required: true
    },
    subText:String
  },
  methods: {
    changeMask (opacity) {
      this.$refs.mask.style.opacity = opacity
    }
  }
}
</script>

<style scoped lang="scss">
@import "../../assets/css/mixin";
.detail-top{
  width: 100%;
  height: 500px;
  overflow: hidden;
  position: relative;
  img{
    width: 100%;
  }
  .subText{
    width: 90%;
    text-align: center;
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.5);
    padding: 10px ;
    border-radius: 20px;
    overflow: hidden;
    p{
      display: inline-block;
      text-align: left;
      color: #fff;
      @include clamp(2);
    }
  }
  .mask{
    position: absolute;
    left: 0;
    top: 0;
    background: #000;
    width: 100%;
    height: 100%;
    opacity: 0;
  }
}
</style>
